#include "CDrawPicture.h"

CDrawPicture::CDrawPicture()
{

}

CDrawPicture::~CDrawPicture()
{

}

void CDrawPicture::setCenterPoint(QPoint point)
{
    m_sCenterPoint = point;
}

void CDrawPicture::setImages(QPixmap image)
{
    m_Pixmap=image;
}

void CDrawPicture::setText(QString sContent)
{
    m_sContent = sContent;
}

QPoint CDrawPicture::GetCenterPoint() const
{
    return m_sCenterPoint;
}

void CDrawPicture::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    this->setZValue(4);
    QRect re(m_sCenterPoint.x(),m_sCenterPoint.y(),80,80);
    painter->drawPixmap(re,m_Pixmap);
    if(m_sLablePoint)
    {
        QPen textpen;
        textpen.setColor(QColor("#E040FB"));
        painter->setPen(textpen);
        painter->drawText(m_sCenterPoint.x()-15,m_sCenterPoint.y()-30,105,40,Qt::AlignCenter,m_sContent);
    }
    if(!m_sLablePoint)
    {
        QPen textpen;
        textpen.setColor(QColor("#E040FB"));
        painter->setPen(textpen);
        painter->drawText(m_sCenterPoint.x()-15,m_sCenterPoint.y()+70,105,40,Qt::AlignCenter,m_sContent);
    }
}
